const baseWidth = 1920;
// const size = 100;

export default (size = 100) => {
  window.onload = function() {
    setRem(baseWidth, size);
  };
  window.onresize = function() {
    setRem(baseWidth, size);
  };
  function setRem(pwidth,prem) {
    const html = document.getElementsByTagName('html')[0];
    const oWidth = window.screen.width;
      // document.body.clientWidth || document.documentElement.clientWidth;
    html.style.fontSize = (oWidth / pwidth) * prem + 'px';
  }
  setRem(baseWidth, size);
};
